//JS实现排序找第几个最大

function findMax(arr,n){
    arr.sort((a,b) => b-a)
    return arr[n-1];
}

console.log(findMax([1,2,3,4,5,6,7,8,9],3));
console.log(findMax([1,2,3,4,5,6,7,8,9],5));
